************************************************
***Title: seasonal_trends_pollen.do
***Creators: Joelle Abramowitz, Shooshan Danagoulian, and Owen Fleming*
***Notes: This file produces a visualization of the seasonality of pollen measurements by locality.

*For questions, contact
*Owen Fleming
*hg3490@wayne.edu
************************************************


**********SETUP
use data/for_analysis, clear


**********PRODUCE VISUALIZATION
preserve
keep if county_measurement == county
collapse (mean) pollen, by(week)
gen county = 0
save data/total_averages, replace
restore

keep if county_measurement == county
collapse (mean) pollen, by(county week)

append using data/total_averages
erase data/total_averages.dta

sort county week

label variable pollen "Weekly Average of Pollen (pcm)"

line pollen week if county==13067, lcolor(gs12) || line pollen week if county==6085, lcolor(gs12) || line pollen week if county== 8041, lcolor(gs12) || line pollen week if county== 9009, lcolor(gs12) || line pollen week if county== 26099, lcolor(gs12) || line pollen week if county== 17031, lcolor(gs12) || line pollen week if county== 21111, lcolor(gs12) || line pollen week if county== 24005, lcolor(gs12) || line pollen week if county== 24031, lcolor(gs12) || line pollen week if county== 29095, lcolor(gs12) || line pollen week if county== 29510, lcolor(gs12) || line pollen week if county== 31153, lcolor(gs12) || line pollen week if county== 36009, lcolor(gs12) || line pollen week if county== 36055, lcolor(gs12) || line pollen week if county== 36061, lcolor(gs12) || line pollen week if county== 37119, lcolor(gs12) || line pollen week if county== 39113, lcolor(gs12) || line pollen week if county== 40109, lcolor(gs12) || line pollen week if county== 40143, lcolor(gs12) || line pollen week if county== 41039, lcolor(gs12)  || line pollen week if county== 10003, lcolor(gs12)  || line pollen week if county==42133, lcolor(gs12)  || line pollen week if county==45045, lcolor(gs12)  || line pollen week if county==49035, lcolor(gs12)  || line pollen week if county== 53033, lcolor(gs12) || line pollen week if county== 55063, lcolor(gs12) || line pollen week if county==6001, lcolor(black) || line pollen week if county==42049, lcolor(blue) || line pollen week if county==0, lcolor(red) lwidth(medthick) legend(order(27 "Alameda County, CA" 28 "Erie County, PA" 29 "All counties")) xlabel(2 "Jan" 6.33 "Feb" 10.66 "Mar" 15 "Apr" 19.33 "May" 23.66 "Jun" 28 "Jul" 32.33 "Aug" 36.66 "Sept" 41 "Oct" 45.33 "Nov" 49.66 "Dec") xtitle(" ") ysize(5) xsize(8) graphregion(color(white)) legend(pos(6))


**********EXPORT
graph export results/seasonal_trends_pollen.png, replace






